package Practice;
import java.util.Scanner;

public class one {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);

        String name;
        int age;
        int price=20;

        for (;;) {
            System.out.println("请输入姓名：");
            name=scan.next();
            if(name.equals("quit")){
                System.out.println("退出程序");
                break;
            }
            System.out.println("请输入年龄:");
            age=scan.nextInt();
            if(name!="quit" && age>12 && age<=100){
                System.out.println(name+"的年龄为："+age+"，门票价格为"+price+"元");

            }else if(name!="quit" && age<=12 && age>0){
                System.out.println(name+"的年龄为："+age+",门票免费");

            }else if(age<=0 || age>100){
                System.out.println("输入错误，请重新输入");
            }
            }
        }
    }

